﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace DoAnTriTueNhanTao
{
    class MyLine
    {
        MyPoint startPoint;
        MyPoint endPoint;
        int _cost;

        int _idxStartPoint;

        public int idxStartPoint
        {
            get { return _idxStartPoint; }
            set { _idxStartPoint = value; }
        }
        int _idxEndPoint;

        public int idxEndPoint
        {
            get { return _idxEndPoint; }
            set { _idxEndPoint = value; }
        }

        public int cost
        {
            get { return _cost; }
            set { _cost = value; }
        }
        public MyLine(MyPoint start, MyPoint end)
        {
            startPoint = start;
            endPoint = end;
        }

        public void Draw(Graphics g)
        {
            Font font = new Font("Arial", 13);
            SolidBrush brush = new SolidBrush(Color.FromArgb(0, 0, 0));
            g.DrawString(idxStartPoint.ToString() + "->" + idxEndPoint.ToString() + ": " + cost.ToString(), font, brush, (startPoint.getX() + endPoint.getX()) / 2, (startPoint.getY() + endPoint.getY()) / 2);


            Pen p = new Pen(Color.Black);
            p.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;


            g.DrawLine(p, startPoint.getX(), startPoint.getY(), endPoint.getX(), endPoint.getY());

            
        }
    }
}
